package com.spring.demo.publicutil.tree;


import com.spring.demo.publicutil.tree.entity.TreeNode;
import com.spring.demo.publicutil.tree.service.TreeService;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author youjc
 * @date 2021年12月20日 13:59
 */
public class StartClass {
    public static void main(String[] args) {
        //List<TreeNode> treeNodeList=getTreeNodeList();





    }
    public static List<TreeNode> getTreeNodeList(){
        Map<String, TreeNode> dataMap = new HashMap<>(16);
        List<TreeNode> trees = new ArrayList<>();
        TreeNode treeNode1= TreeNode.builder().id("1").build();
        TreeNode treeNode2=TreeNode.builder().parent("1").id("11").build();
        TreeNode treeNode3=TreeNode.builder().parent("1").id("12").build();
        TreeNode treeNode4=TreeNode.builder().parent("11").id("111").build();
        TreeNode treeNode5=TreeNode.builder().parent("12").id("121").build();
        dataMap.put("1",treeNode1);
        dataMap.put("11",treeNode2);
        dataMap.put("12",treeNode3);
        dataMap.put("111",treeNode4);
        dataMap.put("121",treeNode5);
        trees.add(treeNode1);
        trees.add(treeNode2);
        trees.add(treeNode3);
        trees.add(treeNode4);
        trees.add(treeNode5);
        List<TreeNode> treeNodes= TreeService.getTreeNodes(trees, dataMap);



        return trees;
    }
}
